package tmproject.hlhj.fhp.cartrans.activitys

import android.app.Notification
import tmproject.hlhj.fhp.cartrans.BaseAty
import tmproject.hlhj.fhp.cartrans.IView.UpdataView
import tmproject.hlhj.fhp.cartrans.R
import tmproject.hlhj.fhp.cartrans.javaBean.VersionBean
import tmproject.hlhj.fhp.cartrans.presenter.UpdataPresenter
import android.content.Intent
import com.tencent.bugly.beta.Beta
import kotlinx.android.synthetic.main.aty_upgrade.*
import tmproject.hlhj.fhp.cartrans.utils.VersionUtil


/**
 * Created by Never Fear   on 2018\8\29 0029.
Never More....
 */
class UpdataAty :BaseAty<UpdataView,UpdataPresenter>(), UpdataView {
    override fun bindView(): UpdataView {
        return this
    }

    override fun createPresenter(): UpdataPresenter {
        return UpdataPresenter()
    }

    override fun getContentId(): Int {
        return R.layout.aty_upgrade
    }

    override fun initView() {
        val info = Beta.getUpgradeInfo()
//        info.versionCode
        if (info!=null){
            tvNew.text="最新版本：${info.versionName}"
        }else{
            tvNew.text="最新版本：${VersionUtil.getVerName(this).toString()}"
        }
        verSionNow.text="当前版本：${VersionUtil.getVerName(this).toString()}"
    }

    override fun logicStart() {
    }

    override fun setVersion(versionBean: VersionBean) {
    }

    override fun setListener() {
        btExit.setOnClickListener {
            finish()
        }
        btUpdate.setOnClickListener {
            Beta.checkUpgrade()
        }
    }
}